package com.jk.hearthstone.card.biology.entourage;

import com.jk.hearthstone.card.BaseCard;
import com.jk.hearthstone.card.biology.BaseBiology;
import com.jk.hearthstone.card.magic.BaseMagic;
import com.jk.hearthstone.core.BaseController;
import com.jk.hearthstone.core.Controller;
import com.jk.hearthstone.core.ControllerAdapter;
import com.jk.hearthstone.data.Desktop;
import com.jk.hearthstone.data.History;

/**
 * @author jk
 */
public class 法力浮龙 extends BaseEntourage {


    public 法力浮龙(Controller controller){
        cost = 2;
        att = 1;
        hp = 3;
        maxHp = 3;
        controller.appendController(getMyController());
    }

    @Override
    public BaseController getMyController(){
        if(myController == null){
            myController = new ControllerAdapter(){
                @Override
                public boolean play(Desktop desktop, History history, BaseCard card) {
                    //遍历场怪 首先保证这张牌在场上
                    for (BaseEntourage entourage : desktop.myEntourage) {
                        //牌在场上，且打出的牌是法术牌
                        if(entourage == 法力浮龙.this && card instanceof BaseMagic){
                            法力浮龙.this.att++;
                        }
                    }
                    return true;
                }

                @Override
                public boolean play(Desktop desktop, History history, BaseCard card, BaseBiology target) {
                    return play(desktop,history,card);
                }
            };
        }
        return myController;
    }

    @Override
    public void afterMagic(Desktop desktop, History history) {
        this.att++;
    }
}
